<?php /* Smarty version 2.6.20, created on 2011-10-25 17:38:12
         compiled from _core/_include/module/_mvc/view/icontainersampleattribute.tpl */ ?>
function IContainerSampleAttribute(container, item, options) {
  this._container = container;
  this._item = item;
  this._options = options;
  
  this._createElements();
};

IContainerSampleAttribute.prototype._createElements = function() {
  var div, table, tr, td, input, select, unique = MiscUtils.unique();
  
  table = document.createElement('table');
  table.style.backgroundColor = '#ebebe3'
  table.style.padding = '10px 0';
  table.style.width = '900px';
  table.style.height = '20px';
  table.style.margin = '-2px 0 0 0';
  table.cellPadding = 0;
  table.cellSpacing = 0;
  table.style.borderRight = 'solid 1px #8f8f8a';
  table.style.borderBottom = 'solid 1px #8f8f8a';
  table.style.borderLeft = 'solid 1px #fff';
  this._container.appendChild(table);
  
  tr = table.insertRow(-1);
  td = tr.insertCell(-1);
  td.align = 'center';
  td.style.verticalAlign = 'middle';
  var itable = document.createElement('table');
  itable.style.width = '860px';
  itable.style.height = '60px';
  itable.cellPadding = 0;
  itable.cellSpacing = 0;
  td.appendChild(itable);
  itr = itable.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.style.width = '100px';
  itd.style.height = '20px';
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  itd.style.fontFamily = 'Arial';
  itd.style.fontSize = '13px';
  itd.style.color = '#695f55';
  itd.style.fontWeight = 'bold';
  itd.appendChild(document.createTextNode('Attribute '));
  itd.appendChild(document.createTextNode(parseInt(this._options.index + 1)));
  itd = itr.insertCell(-1);
  itd.style.width = '700px';
  itd = itr.insertCell(-1);
  itd.style.width = '60px';
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  var del = document.createElement('img');
  del.src = 'images/common/delete.png';
  del.style.cursor = 'pointer';
  del.id = unique + '_remove_button';
  itd.appendChild(del);
  
  itr = itable.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.style.width = '100px';
  itd.style.height = '20px';
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  itd.style.fontSize = '13px';
  itd.style.color = '#695f55';
  itd.style.fontWeight = 'bold';
  itd.appendChild(document.createTextNode('Name'));
  itd = itr.insertCell(-1);
  itd.style.width = '700px';
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  input = DOMUtils.createInput(null, null, 'text', this._item.name, null);
  input.style.borderRight = 'solid 1px #fff';
  input.style.borderBottom = 'solid 1px #fff';
  input.style.borderTop = 'solid 1px #d2c4b9';
  input.style.borderLeft = 'solid 1px #d2c4b9';
  input.style.width = '140px';
  input.style.height = '18px';
  input.id = unique + '_name_text';
  itd.appendChild(input);
  itd = itr.insertCell(-1);
  itd.style.width = '60px';
  
  itr = itable.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.style.width = '100px';
  itd.style.height = '30px';
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  itd.style.fontSize = '13px';
  itd.style.color = '#695f55';
  itd.style.fontWeight = 'bold';
  itd.appendChild(document.createTextNode('Options'));
  var option = DOMUtils.createInput('', '', 'button', '', null);
  option.className = "addoption";
  option.style.margin = '3px 0';
  option.id = unique + '_addOption_button';
  itd.appendChild(option);
  
  itd = itr.insertCell(-1);
  itd.style.width = '700px';
  itd.style.height = '30px';
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  var optionTable = document.createElement('table');
  optionTable.style.width = '160px';
  optionTable.style.height = '30px';
  optionTable.cellSpacing = 0;
  optionTable.cellPadding = 0;
  itd.appendChild(optionTable);
  
  for (var i = 0, il = this._item.options.length; i < il; i++) {
    var option = this._item.options[i];
    
    otable = document.createElement('table');
    otable.style.width = '150px';
    otable.style.height = '28px';
    otable.cellPadding = 0;
    otable.cellSpacing = 0;
    
    if (optionTable.rows.length == 0)  {
      optionTable.insertRow(-1).insertCell(-1).appendChild(otable);
    } else if (optionTable.rows[optionTable.rows.length - 1].cells.length < 4) {
      optionTable.rows[optionTable.rows.length - 1].insertCell(-1).appendChild(otable);
    } else {
      optionTable.insertRow(-1).insertCell(-1).appendChild(otable);
    }
    
    otr = otable.insertRow(-1);
    otd = otr.insertCell(-1);
    otd.style.width = '100px';
    otd.style.textAlign = 'left';
    otd.style.verticalAlign = 'top';
    otd.style.paddingTop = '2px';
    otd.style.fontSize = '13px';
    otd.style.fontFamily = 'Tahoma';
    otd.style.fontWeight = 'bold';
    otd.style.color = '#0099cc';
    input = DOMUtils.createInput(null, null, 'text', option.name, null);
    input.style.borderRight = 'solid 1px #fff';
    input.style.borderBottom = 'solid 1px #fff';
    input.style.borderTop = 'solid 1px #d2c4b9';
    input.style.borderLeft = 'solid 1px #d2c4b9';
    input.style.width = '95px';
    input.style.height = '18px';
    input.id = unique + '_' + i + '_name_text';
    otd.appendChild(input);
    
    otd = otr.insertCell(-1);
    otd.style.textAlign = 'left';
    otd.style.verticalAlign = 'top';
    otd.style.paddingTop = '2px';
    var del = document.createElement('img');
    del.src = 'images/buttons/del.png';
    del.style.cursor = 'pointer';
    del.style.margin = '1px 0 0 4px';
    del.id = unique + '_' + i + '_remove_button';
    otd.appendChild(del);
  }
  itd = itr.insertCell(-1);
  itd.style.width = '60px';
  
  gui = GuiContainerSampleAttribute.instance(unique, this._item);
  new HandleContainerSampleAttribute(gui, this._item, this._options);
};